
package com.ami.kvm.jviewer.soc;

import java.awt.image.BufferedImage;
import java.awt.image.DataBuffer;
import java.awt.image.DataBufferByte;
import java.awt.image.WritableRaster;
import java.util.Arrays;

import com.ami.kvm.jviewer.common.ISOCCreateBuffer;
import com.ami.kvm.jviewer.gui.JViewerApp;

public class SOCCreateBufferImage implements ISOCCreateBuffer {
	public BufferedImage m_image;
	public boolean colorChange = false;

	public void prepareBufImage(int paramInt1, int paramInt2, int paramInt3) {
		this.m_image = new BufferedImage(paramInt1, paramInt2, 5);
		setM_image(this.m_image);
	}

	public DataBuffer imageDataBuffer() {
		WritableRaster localWritableRaster = null;
		localWritableRaster = this.m_image.getRaster();
		return localWritableRaster.getDataBuffer();
	}

	public byte[] imageMemoryByte() {
		WritableRaster localWritableRaster = this.m_image.getRaster();
		DataBufferByte localDataBufferByte = (DataBufferByte) localWritableRaster.getDataBuffer();
		return localDataBufferByte.getData();
	}

	public void clearImage() {
		byte[] arrayOfByte = imageMemoryByte();
		if (arrayOfByte != null) {
			Arrays.fill(arrayOfByte, (byte) 0);
		}
	}

	public void SetImage(BufferedImage paramBufferedImage) {
		this.m_image = paramBufferedImage;
		JViewerApp.getInstance().getRCView().setRCView(this.m_image.getWidth(), this.m_image.getHeight(), -1);
	}

	public BufferedImage getM_image() {
		return this.m_image;
	}

	public void setM_image(BufferedImage paramBufferedImage) {
		this.m_image = paramBufferedImage;
	}
}
